import glumpy
from gl_shapes import *


fig = glumpy.figure( (800,800) )
smooth()

mouse_x = 0
mouse_y = 0

@fig.event
def on_draw():
    fig.clear()
    ellipse(c=(mouse_x,0),h=40.0, w=40.0, a=0.0, color=(1.0,0,0,0.75), step=20, stroke=1.0, type="fill")
    ellipse(c=(0,mouse_y),h=40.0, w=40.0, a=0.0, color=(0.0,1,0,0.75), step=20, stroke=1.0, type="fill")

@fig.event
def on_mouse_motion(x, y, dx, dy):
    # print 'Mouse motion (x=%.1f, y=%.1f, dx=%.1f, dy=%.1f)' % (x,y,dx,dy)
    global mouse_x, mouse_y
    mouse_x = x
    mouse_y = y

    #tell python to redraw the figure
    fig.redraw()









@fig.event
def on_mouse_press(x, y, button):
    # print 'Mouse button pressed (x=%.1f, y=%.1f, button=%d)' % (x,y,button)
    pass

@fig.event
def on_key_press(symbol, modifiers):
    # print 'Key pressed (symbol=%s, modifiers=%s)'% (symbol,modifiers)
    pass

glumpy.show()